//
//  TrtcEngine.swift
//  onemeetingmac
//
//  Created by 张衡 on 2020/3/10.
//  Copyright © 2020 onemeeting. All rights reserved.
//

import Foundation

public class TrtcEngine: NSObject {
    
    class func tapDuck() {
        if NSApplication.shared.mainWindow?.className == "ZPConfMainWindow" {
            return
        }
        guard let keyWindow = WindowEngine.keyWindow() else {
            return
        }
        keyWindow.makeKeyAndOrderFront(self)
    }
    
    class func exit() {
        guard let keyWindow = WindowEngine.keyWindow() else {
            return
        }
        keyWindow.makeKeyAndOrderFront(self)
    }
    
    class func enter() {
        TrtcEngine.close(classs: [MainViewController.classForCoder(),JoinViewController.classForCoder(),SetViewContrller.classForCoder()])
    }
    
    
    class func close(classs:[AnyClass]) {
        let windows = NSApplication.shared.windows
        for (_,cls) in classs.enumerated() {
            for (_,win) in windows.enumerated(){
                if (win.contentViewController?.isKind(of: cls)) == true{
                    win.close()
                }
            }
        }
    }
}
